package com.party.core.model.wechat;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * 微信菜单动作枚举
 * Created by wei.li
 *
 * @date 2017/8/28 0028
 * @time 16:58
 */
public enum WechatMenuActionType {

    CLICK(0, "click"),

    VIEW(1, "view"),

    IMAGE(2, "image"),

    NEWS(3, "news");

    //状态码
    private Integer code;

    //状态值
    private String value;

    WechatMenuActionType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String getValue(Integer code){
        for (WechatMenuActionType wechatMenuActionType : WechatMenuActionType.values()){
            if (wechatMenuActionType.getCode().equals(code)){
                return wechatMenuActionType.getValue();
            }
        }
        return null;
    }

    public static Map<Integer, String> convertMap(){
        Map<Integer, String> map = Maps.newHashMap();
        for (WechatMessageType wechatMessageType : WechatMessageType.values()){
            map.put(wechatMessageType.getCode(), wechatMessageType.getValue());
        }
        return map;
    }
}
